package simulator;

class Memory{
	
	static char[][] space; //memory space
	int flag; 
	/*shows W/R condition
	 * 0: Disabled
	 * 1: Write
	 * 2: Read
	 * 3: Error
	*/
	
	Memory()
	{
		space = new char[16][4096];
	}
	
	public void read(){
		MBR = space[Integer.parseInt(String.valueOf(MAR))]; //according the address return data
	}
	
	public void write (){
		
		space[Integer.parseInt(String.valueOf(MAR))] = MBR; //write data to specific space of memory pointed by addr
	}
	
	public void SetMAR( char[] val )
	{
		MAR = val;
	}
	public void SetMBR( char[] val)
	{
		MBR = val;
	}
	public char[] GetMBR( )
	{
		return MBR;
	}
	public char[] MBR, MAR;
	
}